package util;

public class fraction {
	
	/**
	 * This function is useful to calculate the gain associated with the partial acquisition (for polygon)
	 * 
	 * @param percentageOfarea
	 * @param x
	 * @return
	 */
	
	 public static double gainOfPartialAcquisition(final int percentageOfarea, final double x){
			double result = 0;
			
			switch (percentageOfarea){
			case 1: //if the percentage of the area acquired is in [0, 0.4]
				result = 0.25 * x;
				break;
			case 2: //if the percentage of the area acquired is in [0.4, 0.7]
				result =  x - 0.3;
				break;
			case 3: //if the percentage of the area acquired is in [0.7, 1]
				result =  (2*x) - 1;
				break;
			default: 
				break;
			}
			return result;
	 }
}
